package com.bs.auth.advice;

import com.bs.common.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author bingshao
 * @date 2023/2/23
 **/
@Slf4j
@ControllerAdvice(basePackages = "com.bs.auth")
public class GlobalExceptionHandler {

    @ResponseBody
    @ExceptionHandler(value = Exception.class)
    public Result<Object> exceptionHandler(Exception e) {
        log.error("GlobalExceptionHandler===========>{}", e.getMessage());
        return Result.fail(e.getMessage());
    }
}
